﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using MilwormsGameData;
#endregion

namespace MilwormsGameContentPipeline
{
    [ContentTypeWriter]
    public class QuestRequirementWriter<T> : MilwormsGameWriter<QuestRequirement<T>>
        where T : ContentObject
    {
        ContentEntryWriter<T> contentEntryWriter = null;

        protected override void Initialize(ContentCompiler compiler)
        {
            contentEntryWriter = compiler.GetTypeWriter(typeof(ContentEntry<T>))
                as ContentEntryWriter<T>;

            base.Initialize(compiler);
        }

        protected override void Write(ContentWriter output, QuestRequirement<T> value)
        {
            output.WriteRawObject<ContentEntry<T>>(value as ContentEntry<T>,
                contentEntryWriter);
        }

        public override string GetRuntimeType(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.QuestRequirement<T>).AssemblyQualifiedName;
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.QuestRequirement<T>.QuestRequirementReader).AssemblyQualifiedName;
        }
    }
}
